package com.study.java.jinjie.jihe.ceshi;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Test {
    public static void main(String[] args) {
        s("张三", "1997-04-17");

    }

    public static void s(String name, String ri){
        Date now = new Date();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy");
        String nowYear = simpleDateFormat.format(now);
        String oldYear = ri.substring(0, 4);
        int age = Integer.valueOf(nowYear) - Integer.valueOf(oldYear);
        SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("MMdd");
        String nowSheng = simpleDateFormat2.format(now);
        String oldSheng1 = ri.substring(5, 10);
        String oldSheng = oldSheng1.replace(Character.toString('-'), "");
        boolean guo = Integer.valueOf(nowSheng) > Integer.valueOf(oldSheng);
        if (guo){
            System.out.println(name + age+"岁, 今年生日已过" );
        } else {
            System.out.println(name + age+"岁, 今年生日还没过!" );
        }
        String s = "";
    }

}
